<div id="result">
<?php echo $this->Session->flash(); ?>
<h5>Add a category</h5>
<form method="post" id="add_category" action="<?php echo Configure::read('base_url')."add_category/add";?>">
<table cellspacing="0" id="mytable">
          <tbody>
		  <?php foreach($this->data['brand_settings'] as $brand_settings):?>
		  <?php if($brand_settings['Brandsetting']['brand_type']=="brand"):?>
          <tr>
            <td width="27" class="alt"><input type="checkbox"  value="Yes" name="data[global][brand]" checked="checked"  id="checkbox4" /></td>
            <td width="462" class="alt">Show me a list of Global brands to assign them on this category</td>
            </tr>
		<?php elseif($brand_settings['Brandsetting']['brand_type']=="style"):?>			
          <tr>
            <td class="alt"><input type="checkbox" value="Yes" name="data[global][style]"  checked="checked"  id="checkbox5" /></td>
            <td class="alt">Show me a list of Global styles to assign them on this category</td>
            </tr>
		<?php elseif($brand_settings['Brandsetting']['brand_type']=="condition"):?>				
          <tr>
            <td class="alt"><input type="checkbox" value="Yes" name="data[global][condition]" checked="checked"  id="checkbox6" /></td>
            <td class="alt">Show me a list of Global conditions to assign them on this category</td>
            </tr>
		<?php endif; endforeach;?>		
          <tr>
            <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="144">
					<?php if(isset($this->data['catID'])):?><input name="data[parent_id]" type="hidden" id="textfield" value="<?php echo $this->data['catID'];?>"><?php endif;?>
					<?php echo $this->Form->input('category_name',array('label'=>false,'size'=>30,'class'=>"required", 'title'=>"Enter category name here")); ?>
				</td>
                <td width="347"><input type="submit" style="background:#73AE0B; color:#fff; font-size:14px;" name="button" id="button" value="Add" /></td>
              </tr>
            </table></td>
            </tr>
        </tbody></table>
</form>
</div>
<?php  echo $html->script(array("jquery.min.js","jquery.form.js","jquery.validate.js","jquery.pagination.js","jquery.tablesorter.min.js","jquery.tablednd.js")); ?>	 
 <script type="text/javascript">  
 jQuery(document).ready(function(){
 jQuery("#category_table").tablesorter({headers: { 2:{sorter: false},3:{sorter: false}, 4:{sorter: false}, 5:{sorter: false}}}); 
		
		var v = jQuery("#add_category").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
					target: "#result"
				});
			}
		});		
		
//Check all
		$("#select_brand_all").click(function()				
			{
				var checked_status = this.checked;
				$("input[name=data[global_brand][]]").each(function()
				{
					this.checked = checked_status;
				});
			});
			$("#select_style_all").click(function()				
			{
				var checked_status = this.checked;
				$("input[name=global_style[]]").each(function()
				{
					this.checked = checked_status;
				});
			});
			$("#select_condition_all").click(function()				
			{
				var checked_status = this.checked;
				$("input[name=global_condition[]]").each(function()
				{
					this.checked = checked_status;
				});
			});
	});
 </script>